from pymem import Pymem

PVZ_memory = Pymem()
PVZ_pid = 0
PVZ_version = "未找到游戏"
zombies_HP_addresses = None
plant_size = 304
zombie_size = 304


def update_PVZ_memory(memory):
    global PVZ_memory, plant_size, zombie_size
    PVZ_memory = memory
    try:
        plant_size = PVZ_memory.read_int(0x41C965)
        zombie_size = PVZ_memory.read_int(0x41C905)
    except:  # noqa: E722
        plant_size = 304
        zombie_size = 304


def update_PVZ_pid(pid):
    global PVZ_pid
    PVZ_pid = pid


def update_PVZ_version(version):
    global PVZ_version
    global zombies_HP_addresses
    PVZ_version = version
    zombies_HP_addresses = get_zombies_HP_addresses(PVZ_version)
    print(PVZ_version)


baseAddress = 0x006A9EC0

zombiesType = [
    "普僵",
    "旗帜",
    "路障",
    "撑杆",
    "铁桶",
    "冰车二爷",
    "铁门",
    "黑橄榄",
    "武装舞王",
    "舞伴",
    "泳圈普僵",
    "潜水",
    "冰车巨人",
    "雪橇",
    "海豚机枪",
    "小丑",
    "气球舞王",
    "矿工",
    "跳跳",
    "冰车雪人",
    "飞贼",
    "扶梯",
    "篮球",
    "巨人",
    "小鬼",
    "僵王",
    "豌豆僵尸",
    "坚果僵尸",
    "辣椒僵尸",
    "机枪僵尸",
    "冰窝瓜僵尸",
    "高冰果僵尸",
    "红眼",
    "迪斯科",
    "舞者",
    "骷髅",
    "死灵法师",
    "火焰迪斯科",
    "火焰舞者",
    "小黄鸭僵尸",
    "床车僵尸",
    "小摔哥僵尸",
    "橄榄巨人",
    "橄榄小鬼",
    "雪人矿工",
    "狂野机枪僵尸",
    "火炬坚果僵尸",
    "机枪撑杆僵尸",
    "机枪海豚僵尸",
    "僵尸坚果巨人",
    "僵尸豌豆小鬼",
    "鲨鱼僵尸",
    "寒冰射手僵尸",
    "海妖僵尸",
    "缠绕潜水僵尸",
    "钻石僵尸",
    "防爆门僵尸",
    "骑鸭僵尸",
    "小推车小鬼僵尸",
    "罐子僵尸",  # 59
    "催眠师僵尸",  # 60
    "园丁僵尸",  # 61
    "红眼舞王",  # 62
    "巨人伴舞",  # 63
    "影子僵尸",  # 64
    "矿工地刺小鬼",  # 65
    "冲锋黑橄榄红眼巨人僵尸",  # 66
    "冲锋黑橄榄红眼小鬼僵尸",  # 67
    "红眼冰车僵尸",  # 68
    "双发仙人掌僵尸",  # 69
    "套盒坚果僵尸",  # 70
    "至尊VIP坚果僵尸",  # 71
    "三线玉米投手僵尸",  # 72
    "冰霜巨人僵尸",  # 73
    "埃德加二世",  # 74
    "机枪冰车僵尸",  # 75
    "干扰车僵尸",  # 76
    "向日葵僵尸",  # 77
    "农夫僵尸",  # 78
    "财主僵尸",  # 79
    "跳跳舞王僵尸",  # 80
    "跳跳舞伴僵尸",  # 81
    "投冰车僵尸",  # 82
    "幽灵僵尸",  # 83
    "模仿者僵尸",  # 84
    "树人僵尸",  # 85
    "僵尸虫子",  # 86
    "橄榄撑杆僵尸",  # 87
    "矿工巨人僵尸",  # 88
    "矿工小鬼僵尸",  # 89
    "海盗船长僵尸",  # 90
    "海盗船员僵尸",  # 91
    "磁场僵尸",  # 92
    "蜗牛小鬼僵尸",  # 93
    "猫战士僵尸",  # 94
    "气球车僵尸",  # 95
    "橄榄球雪人僵尸",  # 96
    "重生法师僵尸",  # 97
    "雪人雪橇僵尸小队",  # 98
    "武装雪橇僵尸队员",  # 99
    "吸血鬼僵尸",  # 100
    "跳棋僵尸",  # 101
    "猴子僵尸",  # 102
    "市场僵尸",  # 103
    "天使僵尸",  # 104
    "读报迪斯科僵尸",  # 105
    "愤怒的舞者僵尸",  # 106
    "潜水海豚僵尸",  # 107
    "舞王海豚僵尸",  # 108
    "伴舞海豚僵尸",  # 109
    "玩偶匣撑杆僵尸",  # 110
    "烟雾机僵尸",  # 111
]
zombieSpaw = zombiesType + [
    "绿帽概率",
    "橄榄废稿头概率",
    "舞王废稿头概率",
    "巨人废稿头概率",
]
itemType = [
    "未知0",
    "墓碑",
    "坑洞",
    "梯子",
    "蓝色传送门",
    "白色传送门",
    "未知6",
    "罐子",
    "未知8",
    "未知9",
    "蜗牛",
    "钉耙",
    "脑子",
    "未知13",
    "未知14",
    "小黄鸭",
]
shovelType = [
    "普通铲子",  # 0
    "银铲子",  # 1
    "金铲子",  # 2
    "钻石铲子",  # 3
    "星星铲子",  # 4
    "寒冰铲子",  # 5
    "辣椒铲子",  # 6
    "骷髅铲子",  # 7
    "旋风铲子",  # 8
    "南瓜铲子",  # 9
    "礼盒铲子",  # 10
    "魅惑铲子",  # 11
    "汉堡铲子",  # 12
    "豪华铲子",  # 13
    "卡牌铲",  # 14
    "智慧铲",  # 15
]
plantsType = [
    "豌豆向日葵",  # 0
    "阳光豆",  # 1
    "阳光炸弹",  # 2
    "火炬坚果",  # 3
    "阳光土豆雷",  # 4
    "寒冰香蒲",  # 5
    "大蒜花",  # 6
    "双发仙人掌",  # 7
    "小盆菇",  # 8
    "阳光向日葵",  # 9
    "冰瓜大喷菇",  # 10
    "墓碑埋雷者",  # 11
    "红眼菇",  # 12
    "阳光胆小菇",  # 13
    "雪花寒冰菇",  # 14
    "魅惑毁灭菇",  # 15
    "豌豆睡莲",  # 16
    "冰菇窝瓜",  # 17
    "豌豆许愿池",  # 18
    "毁灭海草",  # 19
    "樱桃辣椒",  # 20
    "黄油地刺",  # 21
    "冰炬树桩",  # 22
    "高冰果",  # 23
    "海坚果",  # 24
    "6号路灯花",  # 25
    "豌豆大炮",  # 26
    "仙人三叶草",  # 27
    "玉米卷香蒲",  # 28
    "地刺杨桃",  # 29
    "忧郁南瓜头",  # 30
    "磁力坚果",  # 31
    "机枪卷心菜投手",  # 32
    "阳光花盆",  # 33
    "三线玉米投手",
    "随机植物盒子",
    "魅惑大蒜",
    "咖啡伞",
    "仙人三叶花",
    "西瓜坚果",
    "汉堡射手",
    "阳光南瓜掌",
    "黄油忧郁菇",
    "西瓜香蒲",
    "阳光菇投手",
    "金盏吸金磁",
    "钢刺坚果王",
    "毁灭加农炮",
    "模仿者",
    "爆炸坚果",
    "巨大坚果",
    "芽",
    "(反向)双发仙人掌",
    "<null>",
    "火焰",  # 54
    "伟伟迷",  # 55
    "呼叫网管",  # 56
    "我方铁门僵尸",  # 57
    "忧郁菇投手子弹",  # 58
    "6号路灯花亡语",  # 59
    "终极射手",  # 60
    "向日葵公主",  # 61
    "汉堡王",  # 62
    "可乐(攻速翻倍)",  # 63
    "薯条(血量翻倍)",  # 64
    "南瓜炮子弹",  # 65
    "花盆",  # 66
    "荷叶",  # 67
    "七色花",  # 68
    "腾腾游记四叶草",  # 69
    "地刺子弹",  # 70
    "瓜子",  # 71
    "防爆门僵尸(我方)",  # 72
    "杨桃",  # 73
    "红包",  # 74
    "火爆地雷",
    "火爆坚果墙",
    "豌豆香蒲",
    "冰瓜香蒲",
    "烈火南瓜头",
    "僵尸豌豆射手",
    "寒冰三叶草",
    "热狗射手",
    "寒冰仙人掌",
    "影流窝瓜王",
    "黄油JOKER",
    "向日葵女王",
    "大蒜辣椒",
    "至尊VIP坚果",
    "僵尸坚果墙",
    "魅惑菇射手",
    "财神金盏花",
    "猫砂盆",
    "坑洞坚果",
    "QQ弹弹大喷菇",
    "寒冰地刺",
    "土杨桃",
    "精灵菇",
    "川菜投手",
    "坚果模仿者",
    "窝瓜坚果",
    "冰冻坚果",
    "头脑风暴",
    "宝藏吞噬者",
    "全息卡牌投影",
    "成长咖啡豆",
    "寒光菇",
    "骄阳豌豆射手",
    "荧光木槌",
    "狂野机枪射手",
    "生命重塑者",
    "双生樱桃",
    "幸运四叶草",
    "黄金向日葵",
    "土豆加农炮",
    "惩戒牢笼",
    "备用物资",
    "地刺大嘴花",
    "僵尸豆",
    "禁忌毁灭菇",
    "消消乐糖果",
    "海冰菇",
    "莲叶壳",
    "小猫向日葵",
    "礼盒机",
    "招财猫",
    "水晶蜗牛",
    "坚果存钱罐",
    "吸金磁射手",
    "钻石种子",
    "抽奖盒子豪华版",
    "炫彩杨桃",
    "坚果保龄球",
    "进化豆",
    "流星",
    "苹果闹钟",
    "海豌豆",
    "豌豆海草",
    "海洋星",
    "套盒坚果",
    "鱼饵菇",
    "花盆睡莲",
    "忧郁菇投手",
    "受伤的向日葵",
    "医用咖啡豆",
    "受伤的大喷菇",
    "寒冰加农炮",
    "黄金西瓜投手",
    "寒冰菇王",
    "自费盒子",
    "内卷投手",
    "制冰豆",
    "伪装的向日葵",
    "骄阳玉米投手",
    "辣椒重塑者",
    "棱镜向日葵",
    "大王钢齿花",
    "促销豆",
    "促销坚果",
    "促销花盆",
    "天使向日葵",
    "回收高坚果",  # 161
    "彩虹糖果",  # 162
    "百变高坚果",  # 163
    "逆时闹钟",  # 164
    "阳光加农炮",  # 165
    "禁忌寒冰菇",  # 166
    "冰火裂荚射手",  # 167
    "豌豆炸弹",  # 168
    "辣椒阳光菇",  # 169
    "豆荚壳",  # 170
    "忧郁咖啡豆",  # 171
    "荷包蛋",  # 172
    "冰冰凉凉大喷菇",  # 173
    "冰焰南瓜头",  # 174
    "至尊VIP树桩",  # 175
    "灵魂豆",  # 176
    "星星盒子",  # 177
    "猫窝",  # 178
    "黄金锤子",  # 179
    "车轮重塑者",  # 180
    "迷幻投手",  # 181
    "玉米旋转机",  # 182
    "雷果子",  # 183
    "保龄球彩蛋",  # 184
    "叶子高坚果",  # 185
    "西瓜大喷菇",  # 186
    "南瓜加农炮",  # 187
    "小喷菇投手",  # 188
    "玉米卷迫击炮",  # 189
    "火炬辣椒",  # 190
    "僵尸向日葵 ",  # 191
    "大嘴阳光菇",  # 192
    "花盆睡莲",  # 193
    "机枪花盆",  # 194
    "大海菇",  # 195
    "咖啡三叶草",  # 196
    "僵尸加农炮",  # 197
    "阳光魅惑菇",  # 198
    "墓碑爆破者",  # 199
    "火炬保护伞",  # 200
    "地刺伞",  # 201
    "磁力土豆雷",  # 202
    "地刺西瓜投手",  # 203
    "磁力地刺王",  # 204
    "南瓜灯",  # 205
    "卡牌模仿者",  # 206
    "烈焰毁灭菇",  # 207
    "丛林散装豌豆",  # 208
    "火炬辣椒豆",  # 209
    "禁忌咖啡豆",  # 210
    "南瓜投手",  # 211
    "南瓜盒子",  # 212
    "坚果向日葵",  # 213
    "寒冰炸弹",  # 214
    "杨桃三线射手",  # 215
    "缠绕灯草",  # 216
    "冰炬魅惑菇",  # 217
    "土豆窝瓜雷",  # 218
    "樱桃豆",  # 219
    "杨桃树桩",  # 220
    "鬼影魅惑菇",  # 221
    "迷你汉堡射手",  # 222
    "浴火三线射手",  # 223
    "猫猫星机枪",  # 224
    "潜艇烟花",  # 225
    "升值豆",  # 226
    "向日葵",  # 227
    "豌豆射手",  # 228
    "坚果墙",  # 229
    "樱桃炸弹",  # 230
    "咖啡猫",  # 231
    "大嘴机枪射手",  # 232
    "钻石坚果",  # 233
    "金盏花",  # 234
    "僵尸火炬树桩",  # 235
    "魅灯花",  # 236
    "杨桃磁力菇",  # 237
    "樱桃玉米投手",  # 238
    "魅惑海草",  # 239
    "僵尸地刺",  # 240
    "刺球子弹",  # 241
    "大蒜三线射手",  # 242
    "樱桃大喷菇",  # 243
    "肥料高坚果",  # 244
    "蜗牛大嘴花",  # 245
    "巧克力坚果",  # 246
    "搬运车花盆",  # 247
    "巧克力",  # 248
    "卷心菜重炮连",  # 249
    "财运树桩",  # 250
    "杀虫剂大喷菇",  # 251
    "金色向日葵",  # 252
    "手套豆",  # 253
    "聚宝盆",  # 254
    "唱片机胆小菇",  # 255
    "水壶投手",  # 256
    "樱桃土豆雷",  # 257
    "大蒜高坚果",  # 258
    "辣椒杀虫剂",  # 259
    "重塑牌肥料",  # 260
    "钥匙咖啡豆",  # 261
    "窝瓜忧郁菇",  # 262
    "杨桃保护伞",  # 263
    "治愈花盆",  # 264
    "樱桃吸金磁",  # 265
    "受伤的高坚果",  # 266
    "绷带坚果炮",  # 267
    "三叶大嘴花",  # 268
    "魔术盒子",  # 269
    "火爆双发射手",  # 270
    "迷你寒冰菇",  # 271
    "缠绕水雷",  # 272
    "南瓜垃圾桶",  # 273
    "扫把咖啡豆",  # 274
    "坚果南瓜头",  # 275
    "刚刺南瓜头",  # 276
    "旗帜僵尸豆",  # 277
    "大蒜炸弹",  # 278
    "大蒜毒气",  # 279
    "骄阳仙人掌",  # 280
    "天秤咖啡豆",  # 281
    "银河星星果",  # 282
    "僵尸机枪射手",  # 283
    "寒冰磁力菇",  # 284
    "寒冰豆",  # 285
    "极寒冰瓜投手",  # 286
    "地刺花盆",  # 287
    "南瓜保护伞",  # 288
    "忧郁魅惑菇",  # 289
    "磁力玉米投手",  # 290
    "充能磁铁",  # 291
    "坚果保护伞",  # 292
    "魅惑盒子",  # 293
    "友望云霄洗地机",  # 294
    "极寒冰菇",  # 295
    "大蒜花盆",  # 296
    "胆小阳光菇",  # 297
    "缠绕睡莲",  # 298
    "三叶大喷菇",  # 299
    "雪莲",  # 300
    "猫尾伞",  # 301
    "三叶土豆雷",  # 302
    "玩偶匣磁力菇",  # 303
    "玩偶匣",  # 304
    "随机模仿者",  # 305
]
for _ in range(len(plantsType), 512):
    plantsType.append("占位")
plantsType = plantsType + [
    "普僵",
    "旗帜",
    "路障",
    "撑杆",
    "铁桶",
    "冰车二爷",
    "铁门",
    "黑橄榄",
    "武装舞王",
    "舞伴",
    "泳圈普僵",
    "潜水",
    "冰车巨人",
    "雪橇",
    "海豚豌豆骑士",
    "小丑",
    "气球舞王",
    "矿工",
    "跳跳",
    "冰车雪人",
    "飞贼",
    "扶梯",
    "篮球",
    "巨人",
    "小鬼",
    "僵王",
    "豌豆僵尸",
    "坚果僵尸",
    "辣椒僵尸",
    "机枪僵尸",
    "冰窝瓜僵尸",
    "高冰果僵尸",
    "红眼",
    "迪斯科",
    "舞者",
    "骷髅",
    "死灵法师",
    "火焰迪斯科",
    "火焰舞者",
    "小黄鸭僵尸",
    "床车僵尸",
    "小摔哥僵尸",
    "橄榄巨人",
    "橄榄小鬼",
    "雪人矿工",
    "狂野机枪僵尸",
    "火炬坚果僵尸",
    "机枪撑杆僵尸",
    "机枪海豚僵尸",
    "僵尸坚果巨人",
    "僵尸豌豆小鬼",
    "鲨鱼僵尸",
    "寒冰射手僵尸",
    "海妖僵尸",
    "缠绕潜水僵尸",
    "钻石僵尸",
    "防爆门僵尸",
    "骑鸭僵尸",
    "小推车小鬼僵尸",
    "罐子僵尸",  # 315
    "催眠师僵尸",  # 316
    "园丁僵尸",  # 317
    "红眼舞王",  # 318
    "巨人伴舞",  # 319
    "影子僵尸",  # 320
    "矿工地刺小鬼",  # 321
    "冲锋黑橄榄红眼巨人僵尸",  # 322
    "冲锋黑橄榄红眼小鬼僵尸",  # 323
    "红眼冰车僵尸",  # 324
    "双发仙人掌僵尸",  # 325
    "套盒坚果僵尸",  # 326
    "至尊VIP坚果僵尸",  # 327
    "三线玉米投手僵尸",  # 328
    "冰霜巨人僵尸",  # 329
    "埃德加二世",  # 330
    "机枪冰车僵尸",  # 331
    "干扰车僵尸",  # 332
    "向日葵僵尸",  # 333
    "农夫僵尸",  # 334
    "财主僵尸",  # 335
    "跳跳舞王僵尸",  # 336
    "跳跳舞伴僵尸",  # 337
    "投冰车僵尸",  # 338
    "幽灵僵尸",  # 339
    "模仿者僵尸",  # 340
    "树人僵尸",  # 341
    "僵尸虫子",  # 342
    "橄榄撑杆僵尸",  # 343
    "矿工巨人僵尸",  # 344
    "矿工小鬼僵尸",  # 345
    "海盗船长僵尸",  # 346
    "海盗船员僵尸",  # 347
    "磁场僵尸",  # 348
    "蜗牛小鬼僵尸",  # 349
    "猫战士僵尸",  # 350
    "气球车僵尸",  # 351
    "橄榄球雪人僵尸",  # 608
    "重生法师僵尸",  # 609
    "雪人雪橇僵尸小队",  # 610
    "武装雪橇僵尸队员",  # 611
    "吸血鬼僵尸",  # 612
    "跳棋僵尸",  # 613
    "猴子僵尸",  # 614
    "市场僵尸",  # 615
    "天使僵尸",  # 616
    "读报迪斯科僵尸",  # 617
    "愤怒的舞者僵尸",  # 618
    "潜水海豚僵尸",  # 619
    "舞王海豚僵尸",  # 620
    "伴舞海豚僵尸",  # 621
    "玩偶匣撑杆僵尸",  # 622
    "烟雾机僵尸",  # 623
]

ExcludedPutCards = [
    "阳光豆",
    "墓碑埋雷者",
    "豌豆睡莲",
    "毁灭海草",
    "随机植物盒子",
    "毁灭加农炮",
    "宝藏吞噬者",
    "全息卡牌投影",
    "成长咖啡豆",
    "荧光木槌",
    "生命重塑者",
    "幸运四叶草",
    "黄金向日葵",
    "土豆加农炮",
    "备用物资",
    "僵尸豆",
    "莲叶壳",
    "抽奖盒子豪华版",
    "坚果保龄球",
    "进化豆",
    "医用咖啡豆",
    "寒冰加农炮",
    "黄金西瓜投手",
    "自费盒子",
    "制冰豆",
    "促销豆",
    "阳光豆",
    "咖啡伞",
    "豌豆许愿池",
    "天使向日葵",
    "阳光加农炮",
    "生命重塑者",
    "黄金锤子",  # 179
    "火炬辣椒豆",  # 209
    "禁忌咖啡豆",  # 210
    "升值豆",  # 226
]
DownPlantCards = [
    "小盆菇",
    "阳光花盆",
    "猫砂盆",
    "花盆睡莲",
    "促销花盆",
    "荷包蛋",  # 172
    "忧郁咖啡豆",  # 171
    "猫窝",  # 178
    "花盆睡莲",  # 193
    "机枪花盆",  # 194
]
PumpkinPlantCards = [
    "忧郁南瓜头",
    "阳光南瓜掌",
    "烈火南瓜头",
    "冰焰南瓜头",  # 174
    "南瓜灯",  # 205
]
AshPlantCards = [
    "阳光炸弹",
    "雪花寒冰菇",
    "魅惑毁灭菇",
    "樱桃辣椒",
    "仙人三叶草",
    "寒冰三叶草",
    "黄油JOKER",
    "大蒜辣椒",
    "魅惑菇射手",
    "头脑风暴",
    "寒光菇",
    "双生樱桃",
    "惩戒牢笼",
    "禁忌毁灭菇",
    "消消乐糖果",
    "流星",
    "苹果闹钟",
    "寒冰菇王",
    "辣椒重塑者",
    "彩虹糖果",
    "逆时闹钟",
    "禁忌寒冰菇",
    "豌豆炸弹",  # 168
    "灵魂豆",  # 176
    "车轮重塑者",  # 180
    "火炬辣椒",  # 190
    "咖啡三叶草",  # 196
    "墓碑爆破者",  # 199
    "寒冰炸弹",  # 214
    "樱桃豆",  # 219
]


def get_zombies_HP_addresses(PVZ_version):
    print("PVZ_version", PVZ_version)
    if PVZ_version == 2.0:
        return {
            "普僵": 0x005227BB,
            "路障的路障": 0x522892,
            "路障的绿帽": 0x0085A8AF,
            "撑杆": 0x522CBF,
            "撑杆的坚果": 0x0085AA02,
            "铁桶的铁桶": 0x52292B,
            "报纸": 0x52337D,
            "冰车二爷": 0x0085ADCD,
            "铁门的铁门": 0x522949,
            "铁门的路障": 0x0085A0CD,
            "铁门的铁桶": 0x0085A080,
            "橄榄的黑橄榄帽": 0x522BB0,
            "橄榄的废稿头盔": 0x85A794,
            "舞王": 0x523530,
            "舞王的黑橄榄帽": 0x0085A501,
            "舞王的废稿头盔": 0x0085A56D,
            "潜水和投篮的黑橄榄帽": 0x0085A025,
            "大型冰车": 0x522DE1,
            "雪橇车": 0x523139,
            "雪橇小队": 0x0085AB94,
            "海豚": 0x522D64,
            "海豚的路障": 0x0085A6FD,
            "小丑": 0x522FC7,
            "小丑的路障": 0x0085A0EA,
            "气球": 0x005234BF,
            "矿工的橄榄帽": 0x522BEF,
            "矿工本体": 0x0085A6C3,
            "跳跳": 0x523300,
            "跳跳的铁桶": 0x0085A1EC,
            "跳跳的坚果": 0x0085A326,
            "冰车雪人": 0x52296E,
            "蹦极": 0x522A1B,
            "扶梯本体和扶梯": 0x52299C,
            "扶梯的路障": 0x0085A347,
            "扶梯的铁桶": 0x0085A39E,
            "扶梯的坚果": 0x0085A4E0,
            "投石车": 0x522E8D,
            "白眼": 0x523D26,
            "红眼": 0x523E4A,
            "巨人的铁门": 0x0085A5CE,
            "巨人的铁桶": 0x0085A5BA,
            "巨人的黑橄榄帽": 0x0085A6B0,
            "巨人的废稿头盔": 0x0085A656,
            "植物僵尸的铁门": 0x0085A1C6,
            "植物僵尸的路障": 0x0085A1A4,
            "植物僵尸的铁桶": 0x0085A156,
            "坚果僵尸的坚果": 0x52382B,
            "辣椒僵尸的辣椒": 0x523A87,
            "高冰果僵尸的高冰果": 0x52395D,
            "迪斯科僵尸": 0x0085A82D,
            "骷髅": 0x0085AB76,
            "死灵法师": 0x0085ADB2,
            "火焰迪斯科": 0x0085AC14,
            "火焰舞者": 0x0085AD96,
            "床车": 0x0085AE77,
            "小摔哥的睡帽": 0x0085AEC7,
            "小黄鸭的路障": 0x0085AE63,
            "小黄鸭的铁桶": 0x0085AE30,
            "僵王": 0x0085AEE5,
        }
    elif PVZ_version == 2.1 or PVZ_version == 2.2:
        return {
            "普僵": 0x005227BB,
            "路障的路障": 0x00522892,
            "路障的绿帽": 0x008D08AF,
            "路尸的绿帽上限": 0x008D08B9,
            "撑杆": 0x00522CBF,
            "撑杆的坚果": 0x008D0A02,
            "铁桶的铁桶": 0x0052292B,
            "报纸": 0x0052337D,
            "冰车二爷": 0x008D0DCD,
            "铁门的铁门": 0x00522949,
            "铁门的路障": 0x008D00CD,
            "铁门的铁桶": 0x008D0080,
            "橄榄的黑橄榄帽": 0x00522BB0,
            "橄榄的废稿头盔": 0x008D0794,
            "橄榄的废稿头盔上限": 0x008D079E,
            "舞王": 0x00523530,
            "舞王的黑橄榄帽": 0x008D0501,
            "舞王的废稿头盔": 0x008D056D,
            "舞王的废稿头盔上限": 0x008D0577,
            "潜水和投篮的黑橄榄帽": 0x008D0025,
            "大型冰车": 0x00522DE1,
            "雪橇车": 0x00523139,
            "雪橇小队": 0x008D0B94,
            "雪橇小队上限": 0x008D0B9E,
            "小丑": 0x00522FC7,
            "小丑的路障": 0x008D00EA,
            "气球": 0x005234BF,
            "矿工本体": 0x008D06C3,
            "跳跳": 0x00523300,
            "跳跳的铁桶": 0x008D01EC,
            "跳跳的坚果": 0x008D0326,
            "冰车雪人": 0x0052296E,
            "蹦极": 0x00522A1B,
            "扶梯本体和扶梯": 0x0052299C,
            "扶梯僵尸的路障饰品": 0x008D0347,
            "扶梯的路障": 0x008D039E,
            "扶梯的坚果": 0x008D04E0,
            "投石车": 0x00522E8D,
            "白眼": 0x00523D26,
            "红眼": 0x00523E4A,
            "巨人的铁门": 0x008D05CE,
            "巨人的铁桶": 0x008D05BA,
            "巨人的黑橄榄帽": 0x008D06B0,
            "巨人的废稿头盔": 0x008D0656,
            "巨人的废稿头盔上限": 0x008D0660,
            "植物僵尸的铁门": 0x008D01C6,
            "植物僵尸的路障": 0x008D01A4,
            "植物僵尸的铁桶": 0x008D0156,
            "坚果僵尸的坚果": 0x0052382B,
            "辣椒僵尸的辣椒": 0x00523A87,
            "高冰果僵尸的高冰果": 0x0052395D,
            "迪斯科僵尸": 0x008D082D,
            "骷髅": 0x008D0B76,
            "骷髅上限": 0x008D0B80,
            "死灵法师": 0x008D0DB2,
            "火焰迪斯科": 0x008D0C14,
            "火焰舞者": 0x008D0D96,
            "床车": 0x008D0E77,
            "小摔哥的睡帽": 0x008D0EC7,
            "小摔哥的睡帽上限": 0x008D0ED1,
            "小黄鸭的路障": 0x008D0E63,
            "小黄鸭的铁桶": 0x008D0E30,
            "僵王": 0x008D0EE5,
            "橄榄巨人": 0x008D0F04,
            "橄榄巨人头盔": 0x008D0F18,
            "橄榄小鬼头盔": 0x008D0F8F,
            "雪人矿工": 0x008D0FA3,
            "雪人矿工帽": 0x008D0FC9,
        }
    elif PVZ_version == 2.3:
        return {
            "普僵": 0x005227BB,
            "路障的路障": 0x00522892,
            "路障的绿帽": 0x008D08AA,
            "撑杆": 0x00522CBF,
            "撑杆的坚果": 0x008D09FD,
            "铁桶的铁桶": 0x0052292B,
            "报纸": 0x0052337D,
            "冰车二爷": 0x008D0DAE,
            "铁门的铁门": 0x00522949,
            "铁门的路障": 0x008D00CD,
            "铁门的铁桶": 0x008D0080,
            "橄榄的黑橄榄帽": 0x00522BB0,
            "橄榄的废稿头盔": 0x008D078F,
            "舞王": 0x00523530,
            "舞王的黑橄榄帽": 0x008D04E5,
            "舞王的废稿头盔": 0x008D0551,
            "潜水和投篮的黑橄榄帽": 0x008D0025,
            "大型冰车": 0x00522DE1,
            "雪橇车": 0x00523139,
            "雪橇小队": 0x008D0B75,
            "海豚": 0x00522D64,
            "海豚的路障": 0x008D06E1,
            "小丑": 0x00522FC7,
            "小丑的路障": 0x008D00EA,
            "气球": 0x005234BF,
            "矿工本体": 0x008D06A7,
            "跳跳": 0x00523300,
            "跳跳的铁桶": 0x008D01EC,
            "跳跳的坚果": 0x008D0318,
            "冰车雪人": 0x0052296E,
            "蹦极": 0x00522A1B,
            "扶梯本体和扶梯": 0x0052299C,
            "扶梯僵尸的铁桶": 0x008D0390,
            "扶梯的路障": 0x008D0339,
            "扶梯的坚果": 0x008D04C4,
            "投石车": 0x00522E8D,
            "投石车橄榄帽": 0x008D0025,
            "白眼": 0x00523D26,
            "红眼": 0x00523E4A,
            "巨人的铁门": 0x008D05B2,
            "巨人的铁桶": 0x008D059E,
            "巨人的黑橄榄帽": 0x008D0694,
            "巨人的废稿头盔": 0x008D063A,
            "小鬼": 0x005227BB,
            "植物僵尸本体": 0x005227BB,
            "植物僵尸的铁门": 0x008D01C6,
            "植物僵尸的路障": 0x008D01A4,
            "植物僵尸的铁桶": 0x0052292B,
            "坚果僵尸的坚果": 0x0052382B,
            "辣椒僵尸的辣椒": 0x00523A87,
            "高冰果僵尸的高冰果": 0x008D11D1,
            "机枪射手僵尸": 0x008D11A2,
            "火炬坚果僵尸的坚果头": 0x008D12EC,
            "机枪撑杆僵尸": 0x008D1415,
            "机枪海豚僵尸的路障": 0x008D164F,
            "迪斯科僵尸": 0x008D0828,
            "骷髅": 0x008D0B57,
            "死灵法师": 0x008D0D93,
            "火焰迪斯科": 0x008D0BF5,
            "火焰舞者": 0x008D0D77,
            "床车": 0x008D0E58,
            "小摔哥的睡帽": 0x008D0EA8,
            "小黄鸭的路障": 0x008D0E44,
            "小黄鸭的铁桶": 0x008D0E11,
            "僵王": 0x008D0EC6,
            "橄榄巨人": 0x008D0F01,
            "橄榄巨人头盔": 0x008D0F15,
            "橄榄小鬼": 0x005227BB,
            "橄榄小鬼头盔": 0x008D0F8C,
            "雪人矿工": 0x008D0FC6,
            "雪人矿工帽": 0x008D0FA0,
            "钻石僵尸帽": 0x008D1DF7,
            "鲨鱼僵尸": 0x008D1A97,
            "海妖僵尸": 0x008D1C4D,
            "缠绕潜水僵尸": 0x008D1CDA,
        }
    elif PVZ_version == 2.35 or PVZ_version >= 2.36:
        return {
            "普僵": 0x005227BB,
            "路障的路障": 0x00522892,
            "路障的绿帽": 0x008D08AA,
            "撑杆": 0x00522CBF,
            "撑杆的坚果": 0x008D09FD,
            "铁桶的铁桶": 0x0052292B,
            "报纸": 0x0052337D,
            "冰车二爷": 0x008D0DAE,
            "铁门的铁门": 0x00522949,
            "铁门的路障": 0x008D00CD,
            "铁门的铁桶": 0x008D0080,
            "橄榄的黑橄榄帽": 0x00522BB0,
            "橄榄的废稿头盔": 0x008D078F,
            "舞王": 0x00523530,
            "舞王的黑橄榄帽": 0x008D04E5,
            "舞王的废稿头盔": 0x008D0551,
            "潜水和投篮的黑橄榄帽": 0x008D0025,
            "大型冰车": 0x00522DE1,
            "雪橇车": 0x00523139,
            "雪橇小队": 0x008D0B75,
            "海豚": 0x00522D64,
            "海豚的路障": 0x008D06E1,
            "小丑": 0x00522FC7,
            "小丑的路障": 0x008D00EA,
            "气球": 0x005234BF,
            "矿工本体": 0x008D06A7,
            "跳跳": 0x00523300,
            "跳跳的铁桶": 0x008D01EC,
            "跳跳的坚果": 0x008D0318,
            "冰车雪人": 0x0052296E,
            "蹦极": 0x00522A1B,
            "扶梯本体和扶梯": 0x0052299C,
            "扶梯僵尸的铁桶": 0x008D0390,
            "扶梯的路障": 0x008D0339,
            "扶梯的坚果": 0x008D04C4,
            "投石车": 0x00522E8D,
            "投石车橄榄帽": 0x008D0025,
            "白眼": 0x00523D26,
            "红眼": 0x00523E4A,
            "巨人的铁门": 0x008D05B2,
            "巨人的铁桶": 0x008D059E,
            "巨人的黑橄榄帽": 0x008D0694,
            "巨人的废稿头盔": 0x008D063A,
            "小鬼": 0x005227BB,
            "植物僵尸本体": 0x005227BB,
            "植物僵尸的铁门": 0x008D01C6,
            "植物僵尸的路障": 0x008D01A4,
            "植物僵尸的铁桶": 0x0052292B,
            "坚果僵尸的坚果": 0x0052382B,
            "辣椒僵尸的辣椒": 0x00523A87,
            "高冰果僵尸的高冰果": 0x008D11D1,
            "机枪射手僵尸": 0x008D11A2,
            "火炬坚果僵尸的坚果头": 0x008D12EC,
            "机枪撑杆僵尸": 0x008D1415,
            "机枪海豚僵尸的路障": 0x008D164F,
            "迪斯科僵尸": 0x008D0828,
            "骷髅": 0x008D0B57,
            "死灵法师": 0x008D0D93,
            "火焰迪斯科": 0x008D0BF5,
            "火焰舞者": 0x008D0D77,
            "床车": 0x008D0E58,
            "小摔哥的睡帽": 0x008D0EA8,
            "小黄鸭的路障": 0x008D0E44,
            "小黄鸭的铁桶": 0x008D0E11,
            "僵王": 0x008D0F0B,
            "橄榄巨人": 0x008D0F01,
            "橄榄巨人头盔": 0x008D0F15,
            "橄榄小鬼": 0x005227BB,
            "橄榄小鬼头盔": 0x008D0F8C,
            "雪人矿工": 0x008D0FC6,
            "雪人矿工帽": 0x008D0FA0,
            "钻石僵尸帽": 0x008D1DF7,
            "鲨鱼僵尸": 0x008D1A97,
            "海妖僵尸": 0x008D1C4D,
            "缠绕潜水僵尸": 0x008D1CDA,
        }


plants_HP_addresses = {
    "一般植物": 0x00844DBF,
    "火炬坚果/磁力坚果/西瓜坚果": 0x0045E1A7,
    "雪花寒冰菇/汉堡射手/影流窝瓜王/黄油JOKER/大蒜辣椒": 0x00844DCB,
    "豌豆许愿池": 0x00844DD7,
    "高冰果": 0x0045E215,
    "海坚果": 0x00850008,
    "豌豆大炮": 0x008502A6,
    "忧郁南瓜头/阳光南瓜掌/烈火南瓜头/生命重塑者/莲叶壳": 0x0045E445,
    "魅惑大蒜": 0x0045E242,
    "钢刺坚果王": 0x0045E5C3,
    "毁灭加农炮": 0x00850296,
    "爆炸坚果": 0x0045E1BA,
    "巨大坚果": 0x0045E207,
    "火爆坚果墙": 0x00850357,
    "热狗射手": 0x00850057,
    "向日葵女王": 0x008500BA,
    "至尊VIP坚果": 0x008500E6,
    "至尊VIP坚果长大增加的血量": 0x00867E73,
    "僵尸坚果墙": 0x00850112,
    "Cupid魅惑菇射手": 0x00850130,
    "财神金盏花": 0x00850155,
    "坑洞坚果": 0x00850165,
    "窝瓜坚果": 0x008501AC,
    "窝瓜坚果临界血量": 0x008491AB + 3,  # 注意这里的地址需要加上偏移量
    "冰冻坚果": 0x008501BC,
}

# plantPutType = [
#     "豌豆向日葵",
#     "阳光豆",
#     "阳光炸弹",
#     "火炬坚果",
#     "阳光土豆雷",
#     "寒冰香蒲",
#     "大蒜花",
#     "双发仙人掌",
#     "小盆菇",
#     "阳光向日葵",
#     "冰瓜大喷菇",
#     "墓碑埋雷者",
#     "红眼菇",
#     "阳光胆小菇",
#     "雪花寒冰菇",
#     "魅惑毁灭菇",
#     "豌豆睡莲",
#     "冰菇窝瓜",
#     "豌豆许愿池",
#     "毁灭海草",
#     "樱桃辣椒",
#     "黄油地刺",
#     "冰炬树桩",
#     "高冰果",
#     "海坚果",
#     "6号路灯花",
#     "豌豆大炮",
#     "仙人三叶草",
#     "玉米卷香蒲",
#     "地刺杨桃",
#     "忧郁南瓜头",
#     "磁力坚果",
#     "机枪卷心菜投手",
#     "阳光花盆",
#     "三线玉米投手",
#     "随机植物盒子",
#     "魅惑大蒜",
#     "咖啡伞",
#     "仙人三叶花",
#     "西瓜坚果",
#     "汉堡射手",
#     "阳光南瓜掌",
#     "黄油忧郁菇",
#     "西瓜香蒲",
#     "阳光菇投手",
#     "金盏吸金磁",
#     "钢刺坚果王",
#     "毁灭加农炮",
#     "模仿者",
#     "爆炸坚果",
#     "巨大坚果",
#     "芽",
#     "火爆地雷",
#     "火爆坚果墙",
#     "豌豆香蒲",
#     "冰瓜香蒲",
#     "烈火南瓜头",
#     "僵尸豌豆射手",
#     "寒冰三叶草",
#     "热狗射手",
#     "寒冰仙人掌",
#     "影流窝瓜王",
#     "黄油JOKER",
#     "向日葵女王",
#     "大蒜辣椒",
#     "至尊VIP坚果",
#     "僵尸坚果墙",
#     "魅惑菇射手",
#     "财神金盏花",
#     "猫砂盆",
#     "坑洞坚果",
#     "QQ弹弹大喷菇",
#     "寒冰地刺",
#     "土杨桃",
#     "精灵菇",
#     "川菜投手",
#     "坚果模仿者",
#     "窝瓜坚果",
#     "冰冻坚果",
#     "头脑风暴",
#     "宝藏吞噬者",
#     "全息卡牌投影",
#     "成长咖啡豆",
#     "寒光菇",
#     "骄阳豌豆射手",
#     "荧光木槌",
#     "狂野机枪射手",
#     "生命重塑者",
#     "双生樱桃",
#     "幸运四叶草",
#     "黄金向日葵",
#     "土豆加农炮",
#     "惩戒牢笼",
#     "备用物资",
#     "地刺大嘴花",
#     "僵尸豆",
#     "禁忌毁灭菇",
#     "消消乐糖果",
#     "海冰菇",
#     "莲叶壳",
#     "小猫向日葵",
# ]
goldPlant = [
    "高冰果",
    "豌豆大炮",
    "忧郁南瓜头",
    "汉堡射手",
    "黄油忧郁菇",
    "西瓜香蒲",
    "钢刺坚果王",
    "毁灭加农炮",
    "冰瓜香蒲",
    "热狗射手",
    "向日葵女王",
    "至尊VIP坚果",
    "狂野机枪射手",
    "寒冰加农炮",
    "黄金西瓜投手",
]
goldPlantIndex = [23, 26, 30, 40, 42, 43, 46, 47, 78, 82, 86, 88, 109]
mushroomPlant = [
    8,
    9,
    10,
    12,
    13,
    14,
    15,
    17,
    23,
    24,
    30,
    31,
    40,
    42,
    44,
    47,
    83,
    90,
    94,
    97,
    106,
    119,
    121,
]
peaPlant = [0, 16, 18, 26, 32, 40, 77, 80, 82, 107, 109]
melonPlant = [10, 39, 43, 78]
flowerPlant = [0, 2, 9, 86, 123]
bulletType = [
    "豌豆",
    "冰豌豆",
    "卷心菜",
    "西瓜",
    "孢子",
    "冰西瓜",
    "火球(隐形)",
    "星星",
    "仙人掌刺",
    "篮球",
    "玉米粒",
    "毁灭菇",
    "黄油",
    "僵尸豌豆",
    "小阳光菇",
    "大阳光菇",
    "黑色豌豆",
    "寒冰刺",
    "魅惑箭",
    "银币",
    "金币",
    "钻石",
    "土豆雷",
    "川菜",
    "辣椒",
    "白火球",
    "土豆加农炮(无伤害)",
    "冰孢子",
    "小阳光",
    "豌豆僵尸的火豌豆1",
    "豌豆僵尸的火豌豆2",
    "黄金豌豆",
    "大型豌豆",
    "大型火焰豌豆",
    "大型冰焰豌豆",
    "冰焰豌豆",
    "星星",
    "大星星",
    "黄金豌豆2",
    "冰星星",
    "忧郁菇投手",
    "冰大炮",
    "黄金瓜",
    "火玉米",
    "阳光玉米炮",  # 44
    "赤焰豌豆",  # 45
    "紫焰豌豆",  # 46
    "烈焰豌豆",  # 47
    "大型赤焰豌豆",  # 48
    "大型紫焰豌豆",  # 49
    "大型烈焰豌豆",  # 50
    "魅惑菇(伤害)",  # 51
    "魅惑菇(短暂魅惑)",  # 52
    "魅惑菇(自残)",  # 53
    "油炸玉米粒",  # 54
    "爆米花",  # 55
    "南瓜炮",  # 56
    "炸游戏(卷心菜迫击炮)",  # 57
    "炸游戏(玉米迫击炮)",  # 58
    "罐子",  # 59
    "地刺",  # 60
    "雪球",  # 61
    "炸游戏(火焰卷心菜迫击炮)",  # 62
    "炸游戏(火焰玉米迫击炮)",  # 63
    "炸游戏(火焰玉米迫击炮)",  # 64
    "玉米粒",  # 65
    "蛋糕",  # 66
    "分裂星星",  # 67
    "火焰星星",  # 68
    "火焰分裂星星",  # 69
    "红温豌豆",  # 70
    "烈火红温豌豆",  # 71
    "金豌豆",  # 72
    "火焰爆炸星星",  # 73
    "爆炸星星",  # 74
    "大嘴花",  # 75
    "大大嘴花",  # 76
    "绿火豌豆",  # 77
    "钢星星",  # 78
    "粉星星",  # 79
    "玉米粒",  # 80
    "樱桃子弹",  # 81
    "大蒜子弹",  # 82
    "黑蒜子弹",  # 83
    "炸游戏(卷心菜重炮)",  # 84
    "炸游戏(火焰卷心菜重炮)",  # 85
    "金钱阳光",  # 86
    "音符",  # 87
    "重音符",  # 88
    "水弹",  # 89
    "大水弹",  # 90
    "星星(无伤害)",  # 91
    "彩星星(无伤害)",  # 92
    "铁樱桃子弹",  # 93
    "金樱桃子弹",  # 94
    "钻樱桃子弹",  # 95
    "绷带坚果(无伤害)",  # 96
    "火焰辣椒豌豆",  # 97
    "香蕉皮(无伤害)",  # 98
    "骄阳仙人刺",  # 99
    "银河星星",  # 100
    "大银河星星",  # 101
    "冰爆弹",  # 102
    "极寒冰瓜",  # 103
    "投掷磁铁",  # 104
    "充能磁铁",  # 105
    "刺伞",  # 106
]
keyTpye = [
    "无",
    "0",
    "1",
    "2",
    "3",
    "4",
    "5",
    "6",
    "7",
    "8",
    "9",
    "A",
    "B",
    "C",
    "D",
    "E",
    "F",
    "G",
    "H",
    "I",
    "J",
    "K",
    "L",
    "M",
    "N",
    "O",
    "P",
    "Q",
    "R",
    "S",
    "T",
    "U",
    "V",
    "W",
    "X",
    "Y",
    "Z",
    "小0",
    "小1",
    "小2",
    "小3",
    "小4",
    "小5",
    "小6",
    "小7",
    "小8",
    "小9",
    "小*",
    "小+",
    "小-",
    "小.",
    "小\\",
    "F1",
    "F2",
    "F3",
    "F4",
    "F5",
    "F6",
    "F7",
    "F8",
    "F9",
    "F10",
    "F11",
    "F12",
    "~",
]

keyCode = [
    "",
    0x30,
    0x31,
    0x32,
    0x33,
    0x34,
    0x35,
    0x36,
    0x37,
    0x38,
    0x39,
    0x41,
    0x42,
    0x43,
    0x44,
    0x45,
    0x46,
    0x47,
    0x48,
    0x49,
    0x4A,
    0x4B,
    0x4C,
    0x4D,
    0x4E,
    0x4F,
    0x50,
    0x51,
    0x52,
    0x53,
    0x54,
    0x55,
    0x56,
    0x57,
    0x58,
    0x59,
    0x5A,
    0x60,
    0x61,
    0x62,
    0x63,
    0x64,
    0x65,
    0x66,
    0x67,
    0x68,
    0x69,
    0x6A,
    0x6B,
    0x6D,
    0x6E,
    0x6F,
    0x70,
    0x71,
    0x72,
    0x73,
    0x74,
    0x75,
    0x76,
    0x77,
    0x78,
    0x79,
    0x7A,
    0x7B,
    0xC0,
]

TREE_OF_WISDOM_REWARD = [
    (10, "智慧树为你赠送10包花肥"),
    (20, "智慧树为你赠送20块巧克力"),
    (30, "智慧树为你赠送花洒泳池清洁车"),
    (50, "智慧树为你赠送肥料小推车"),
    (100, "智慧树为你赠送卡片铲"),
    (150, "智慧树为你赠送黄金花洒泳池清洁车"),
    (200, "智慧树为你赠送音乐屋顶清理车"),
    (300, "智慧树为你赠送【梦幻彩卡】手套豆"),
    (400, "智慧树为你赠送花园新场景【温馨花园】"),
    (500, "智慧树为你赠送【梦幻彩卡】聚宝盆"),
    (600, "智慧树为你赠送花园新场景【魅惑蘑菇园】"),
    (700, "智慧树为你赠送【梦幻彩卡】水壶投手"),
    (800, "智慧树为你赠送花园新场景【竞技花园】"),
    (900, "智慧树为你开启手套功能，按”GGG“使用手套，一次扣除10金币"),
    (1000, "智慧树为你赠送智慧铲"),
    (1100, "智慧树为你赠送100包花肥"),
    (1200, "智慧树为你赠送200块巧克力"),
    (1300, "智慧树为你赠送300个杀虫剂"),
    (1500, "智慧树为你赠送金牌蜗牛【能为植物施肥+浇水+捡货币】"),
    (2025, "智慧树为你赠送2025留声机【满足全部植物的音乐需求】"),
]
TREE_OF_WISDOM = [
    (1, "感谢你培育我！只要不断给我肥料，我就会给你有价值的信息和道具！"),
    (
        2,
        "当你的坚果受伤了，你可以选择直接在它们身上覆盖同种类的坚果，这叫“坚果包扎术”。",
    ),
    (3, "如果你需要换掉植物下方的花盆只要直接把新的花盆种上去就好了。"),
    (4, "就像莲叶壳是南瓜壳，花盆睡莲本质上是睡莲——所以它不响应花盆替换术。"),
    (
        5,
        "园丁僵尸的搬运车很神奇，它有时候会把那些爆炸的植物重新变回卡片。什么bug？这是特性！",
    ),
    (6, "你也许注意到了，僵尸有时会掉落一本画册。它们都被收藏在第一章画册的左边哦。"),
    (
        7,
        "花园里的臭臭蜗牛能帮你浇水，但他的眼神似乎不太好…又或许是他还不太适应这份工作吧，我猜。",
    ),
    (
        8,
        "有些蘑菇类杂交植物在白天仍然会睡觉，我想这可能是蘑菇基因更多的缘故。在图鉴可以查询谁是这种懒虫。",
    ),
    (9, "嘿，我10米高了！请收下这10包肥料吧，就当是我表示感谢的一点薄礼！"),
    (10, "据说成就界面的深坑直通地球另一端。想要快速返回顶部？试试按下Esc吧。"),
    (11, "睁大眼，仔细看你的选卡界面旁边…那本小小的“简介”可以让你随时查看植物的特点。"),
    (12, "我听说在关卡中按“6”能够跳转到商店。但“6”是什么？你有头绪吗？"),
    (13, "财主僵尸有扔不完的钱币，但金钱属性的植物可不怕它，特别是坚果存钱罐。"),
    (
        14,
        "高冰果僵尸的脑袋血量有8000，非常耐揍。但它不会告诉你，那其实是个头套，它的身体没那么强壮。",
    ),
    (
        15,
        "冰冻和减速效果很“酷”，但落在植物身上就不酷了…好在冰属性和火属性的植物都不会被影响。",
    ),
    (
        16,
        "苹果闹钟是时间暂停器，但它也有普通闹钟的功能。你可以用它唤醒睡觉的家伙，包括植物…和某些僵尸？",
    ),
    (17, "冰霜巨人的冰球没那么坚固。足够的火力，或者一个炸弹，都能将它击碎。"),
    (
        18,
        "火炬辣椒的烈焰，能够保护范围内的植物免受寒冰影响。也许用在下周六的烤棉花糖派对也不错？",
    ),
    (19, "喔！我20米高了！拿着这些巧克力吧，一起吃点甜食庆祝一下！"),
    (
        20,
        "舞王僵尸很强，但当他试图靠气球飞过防线时，会被三叶草或炸弹轻松解决…这世上哪有那么多捷径呢。",
    ),
    (
        21,
        "防爆门僵尸的盾牌有难以想象的防爆能力。但正如再完美的事物也有它的不足，这扇门是拦不住气泡的。",
    ),
    (
        22,
        "埃德加二世的火焰弹看上去势不可挡，但别担心！大部分健康的坚果能够挡下一颗火焰弹，它们很可靠。",
    ),
    (
        23,
        "听说地底的僵尸虫子身上隐藏着什么秘密。你要去捉一只试试看吗？有新发现的话回来分享给我吧。",
    ),
    (
        24,
        "仙人三叶花的风没有其他三叶草那么强劲，但他还是能一下吹跑迷雾。毕竟雾比僵尸轻多了，不是吗？",
    ),
    (
        25,
        "坑洞坚果号称他头顶有一块四维碎片，一不小心没站稳就可能变成一个黑洞…你相信这种说法吗？",
    ),
    (
        26,
        "当你打败一名BOSS僵尸后，它可能会掉落一块很大的钻石晶簇，那是个价值100钻石的宝贝哦！",
    ),
    (
        27,
        "雷果子似乎是由两株这个世界以外的植物杂交而成的，他说他的诞生离不开一些年代久远的奇思妙想。",
    ),
    (
        28,
        "冰瓜大喷菇告诉我，他最近很郁闷：时至今日还有人以为西瓜大喷菇把他替代了，他要怎么解释自己还在呢…",
    ),
    (29, "哇，我已经30米高了！这辆花洒泳池清洁车是我的谢礼，希望它能帮上你的忙！"),
    (
        30,
        "磁场僵尸的磁力源其实是它背后那颗发光的核心，这就是为什么它无需头盔也能吸引火力。",
    ),
    (
        31,
        "魅惑菇射手和迷幻投手看起来像孪生姐妹，但她们其实只是远房亲戚……喔，不过她们曾经是室友。",
    ),
    (32, "卡牌模仿者和模仿者不是同一株植物哦。至于模仿者在哪？你在老地方能找到他的。"),
    (
        33,
        "你听说了吗？浴火三线射手来自另一个世界，汉堡射手说他曾到那里旅行了一阵子，见到了不少新奇的东西。",
    ),
    (
        34,
        "最近是不是有一首歌很流行？卡牌模仿者经常戴着耳机循环，我只能隐约听见一句什么“木屋买买买”…",
    ),
    (
        35,
        "据说杂交植物的历史远比戴夫的实验悠久，某些植物早在豌豆向日葵之前便诞生了…这是一段秘闻。",
    ),
    (
        36,
        "棱镜向日葵跟我说，她小时候分不清玻璃和钻石…所以她那时候一直以为自己是钻石向日葵呢。",
    ),
    (
        37,
        "传说这个世界，在英雄降临之后进行了一次翻天覆地的变化……关于这个传说的真实性，或许你比我更清楚？",
    ),
    (38, "猫猫星机枪前阵子来这找我聊天，向我打听这里的一些机枪为什么都喜欢披个斗篷……"),
    (
        39,
        "那些蓝色的冰火球，我记得它们以前的颜色似乎更深一些。后来可能是冰炬树桩补充了什么微量元素吧。",
    ),
    (
        40,
        "你觉得气球车僵尸车头的装饰眼熟吗？那家伙真的很喜欢自己玩偶匣里的小丑装饰，所以定制了一个大号的。",
    ),
    (
        41,
        "据说高冰果在一场随机植物战役中一战成名，所有看过那条视频的人都开始称他为“战神”了。",
    ),
    (42, "你问QQ弹弹大喷菇的“总有一天”是什么意思？…相信我，你不会想知道的。"),
    (
        43,
        "你知道吗？看起来懒散的猫窝其实每天都会锻炼减脂哦，它以前的样子比现在肥多了。",
    ),
    (
        44,
        "回收高坚果说他每天都要花时间改变头顶的铲子装饰布局，但最后觉得还是猫耳样式最合适。",
    ),
    (
        45,
        "据说向日葵公主经历过整容，但我知道那是绯闻。其实她那段时间只是机票不小心订到非洲…然后晒黑了。",
    ),
    (
        46,
        "黄金西瓜投手、黄金向日葵、进化豆、金色向日葵，这四株植物是远房亲戚…他们的原型都是奖杯来着。",
    ),
    (
        47,
        "有传言称香蒲类的植物拥有“魔法”……我不知道这种说法从哪来的，但它们的追踪能力确实像魔法一样呢。",
    ),
    (
        48,
        "偷偷告诉你：汉堡射手有时会跟我抱怨自己头发太浓密遮住了眼睛。但我从来没见他真正理过发",
    ),
    (
        49,
        "哇，我已经长到50米了！你需要更多的功能道具吗？这辆肥料小推车或许会合你心意！",
    ),
    (100, "呀，我都100米高了！感谢你的培养，请收下这把卡片铲子吧！"),
    (150, "啊哈！我已经有150米了！是时候将你的花洒泳池清洁车升级成镀金版本了！"),
    (
        200,
        "喔，我居然长到200米了！这辆音乐屋顶清理车是我的谢礼，你可以用它防御屋顶哦！",
    ),
    (
        300,
        "感谢你将我培养到300米！这株手套豆以后就跟你混了，我相信它能对你起到帮助的！",
    ),
    (400, "天，我居然都400米高了！作为回报，这座温馨花园以后将会为你开放了！"),
    (500, "难以置信，我已经达到500米了！这个聚宝盆可以为你生产钱币我想你会需要它的！"),
    (
        600,
        "太棒了，我已经600米高了！这是魅惑蘑菇园的钥匙，你现在有更多位置培养蘑菇了！",
    ),
    (
        700,
        "我从没想过我能长到700米！我为你带来了新植物，希望这株水壶投手能成为你的助力！",
    ),
    (
        800,
        "哟，我已经有800米高了！这座竞技花园是我为你准备的，你的更多盆栽有位置放了！",
    ),
    (
        900,
        "哇噢，我已经900米高了！在关卡中连按三次“G”键，可以花10金币购买一次手套的使用权限！",
    ),
    (1000, "终于！我达到了1000米的里程碑！就让这把智慧铲子代表我对你的感谢吧！"),
    (
        1100,
        "哈，我现在长到了1100米！是时候请客了！用这100包肥料好好喂养你花园里的植物吧！",
    ),
    (
        1200,
        "我已经长到了1200米！或许200块巧克力还不足以完全表达我的感谢，之后我会带来更好的礼物！",
    ),
    (1300, "1300米的高空风景真棒！这300瓶杀虫剂是我近期的库存，请随意取用吧！"),
    (
        1400,
        "不可思议！我居然都有1500米高了！这只金牌蜗牛是花园管理的专家，它可以帮助你给植物施肥哦！",
    ),
    (
        2025,
        "呀吼！2025米，这是一个有纪念意义的高度！用这个响彻全场的2025留声机，让你的花园一起随音乐嗨起来吧！",
    ),
    (2026, "谢谢你的照料！我已经把全部智慧都给你了，但是你仍然可以让我长的更高！"),
    (
        40000,
        "谢谢你给我施肥！我现在有点缺乏新的智慧了。但是如果你把我种的更高，我会为你准备更多礼物的！",
    ),
    (40001, "当你活得和我一样长时，你会睡得更少而更易产生幻觉。"),
    (
        40002,
        "如果你弄不明白，什么是森林什么是树，只要记住：森林是树木个体的集合，反过来则不是。",
    ),
    (40003, "历史不停重复着自己，但是某些细节总有所不同。"),
    (
        40004,
        "如果说过去，现在和未来同时存在，它们三位一体，成为一个“轮回”那么经验上的“现在”，也许不过是一个精致的幻觉？",
    ),
    (40005, "勇气易得，奉献难求。"),
    (40006, "我有一些久经考验的智慧……"),
    (40007, "请给我点肥料吧！"),
    (40008, "对于你为我在肥料上的花销，我真的真的很感激！"),
    (40009, "那朵云看起来好像一个大水滴哦！"),
    (40010, "你见过我的堂兄宇宙树了吗？很大！住在瑞典，有好多粉丝呢。"),
    (40011, "我正在一所网上大学学习社会学，我真的学到了很多。"),
    (
        40012,
        "经过我仔细的观察后，我推断出是地球围着太阳转，而不是我们看到的那样：太阳绕着地球转。",
    ),
    (40013, "嗯嗯…… 阳光真是美味啊！"),
    (40014, "哦，不好意思……我刚刚释放了点氧气。"),
    (40015, "天啊，我长叶子了！"),
    (40016, "我感觉我要爆发了！"),
    (40017, "眼下我缺少一些关于世界观的知识！"),
    (40018, "嗯，我确信我享用了些美味的肥料！"),
    (40019, "我觉得我以前看到过云。"),
    (40020, "我会在这里慢慢长高。"),
    (40021, "我正在新陈代谢！"),
    (40022, "我不太明白，你们这些动物怎么整天都在到处走来走去呢……"),
    (40023, "时间对我来说是非常缓慢的！"),
    (40024, "我想我是多年生的！"),
    (40025, "我的木质部发麻了！"),
    (40026, "你只要站在我身边，就能得到很多很多的智慧。"),
    (40027, "我听说过“冬天”。但我可不会期待那种日子。"),
    (
        40028,
        "嘿，我都100英尺高了！庆祝一下吧！输入“daisies”，让僵尸们死的时候留下一朵小菊花。",
    ),
    (40029, "啊哈！我500英尺高了！来点舞蹈吧！输入“dance”，让僵尸们都摇摆起来吧！"),
    (
        40030,
        "喔！我已经1000英尺高了！和我一起输入“pinata”，让僵尸们死的时候吐出糖果，来庆祝吧！",
    ),
]


class plant:
    def __init__(self, addr):
        self.addr = addr
        self.no = PVZ_memory.read_ushort(self.addr + 0x148)
        self.exist = PVZ_memory.read_bool(self.addr + 0x141)
        self.x = PVZ_memory.read_int(self.addr + 0x8)
        self.y = PVZ_memory.read_int(self.addr + 0xC)
        self.row = PVZ_memory.read_int(self.addr + 0x1C)
        self.col = PVZ_memory.read_int(self.addr + 0x28)
        self.type = PVZ_memory.read_int(self.addr + 0x24)
        # 2c 抖动倒计时
        # 30 抖动动画索引
        self.state = PVZ_memory.read_int(self.addr + 0x3C)
        self.hp = PVZ_memory.read_int(self.addr + 0x40)  # 血量
        self.maxhp = PVZ_memory.read_int(self.addr + 0x44)
        self.dieTime = PVZ_memory.read_int(self.addr + 0x4C)
        self.cinderTime = PVZ_memory.read_int(self.addr + 0x50)
        self.effectTime = PVZ_memory.read_int(self.addr + 0x54)  # 阳光豆长大
        self.productTime = PVZ_memory.read_int(self.addr + 0x58)  # 常规攻击
        self.productInterval = PVZ_memory.read_int(self.addr + 0x5C)  # 常规攻击间隔
        self.attackTime = PVZ_memory.read_int(self.addr + 0x90)
        self.sunTime = PVZ_memory.read_int(self.addr + 0xDC)
        self.humTime = PVZ_memory.read_int(self.addr + 0x128)  # 阳光生产
        self.mushroomTime = PVZ_memory.read_int(self.addr + 0x130)
        self.isVisible = PVZ_memory.read_bool(self.addr + 0x18)
        self.isSquash = PVZ_memory.read_bool(self.addr + 0x142)
        self.isSleep = PVZ_memory.read_bool(self.addr + 0x143)
        self.isLight = PVZ_memory.read_bool(self.addr + 0x145)
        self.isAttack = PVZ_memory.read_int(self.addr + 0x48)

    def setExist(self, exist):
        PVZ_memory.write_bool(self.addr + 0x141, exist)

    def setX(self, x):
        PVZ_memory.write_int(self.addr + 0x8, x)

    def setY(self, y):
        PVZ_memory.write_int(self.addr + 0xC, y)

    def setRow(self, row):
        PVZ_memory.write_int(self.addr + 0x1C, row)

    def setCol(self, col):
        PVZ_memory.write_int(self.addr + 0x28, col)

    def setType(self, type):
        PVZ_memory.write_int(self.addr + 0x24, type)

    def setState(self, state):
        PVZ_memory.write_int(self.addr + 0x3C, state)

    def setHP(self, hp):
        PVZ_memory.write_int(self.addr + 0x40, hp)
        PVZ_memory.write_int(self.addr + 0x44, hp)

    def setDieTime(self, dieTime):
        PVZ_memory.write_int(self.addr + 0x4C, dieTime)

    def setCinderTime(self, cinderTime):
        PVZ_memory.write_int(self.addr + 0x50, cinderTime)

    def setEffectTime(self, effectTime):
        PVZ_memory.write_int(self.addr + 0x54, effectTime)

    def setProductTime(self, productTime):
        PVZ_memory.write_int(self.addr + 0x58, productTime)

    def setAttackTime(self, attackTime):
        PVZ_memory.write_int(self.addr + 0x90, attackTime)

    def setProductInterval(self, productInterval):
        PVZ_memory.write_int(self.addr + 0x5C, productInterval)

    def setSunTime(self, sunTime):
        PVZ_memory.write_int(self.addr + 0xDC, sunTime)

    def setHumTime(self, humTime):
        PVZ_memory.write_int(self.addr + 0x12C, humTime)

    def setmushroomTime(self, mushroomTime):
        PVZ_memory.write_int(self.addr + 0x130, mushroomTime)

    def setIsVisible(self, isVisible):
        PVZ_memory.write_bool(self.addr + 0x18, isVisible)

    def setIsSquash(self, isSquash):
        PVZ_memory.write_bool(self.addr + 0x142, isSquash)

    def setIsSleep(self, isSleep):
        PVZ_memory.write_bool(self.addr + 0x143, isSleep)

    def setIsLight(self, isLight):
        PVZ_memory.write_bool(self.addr + 0x145, isLight)

    def setIsAttack(self, isAttack):
        PVZ_memory.write_int(self.addr + 0x48, isAttack)


class zombie:
    def __init__(self, addr):
        self.addr = addr
        self.no = PVZ_memory.read_ushort(self.addr + 0x158)
        self.exist = PVZ_memory.read_int(self.addr + 0xEC)
        self.row = PVZ_memory.read_int(self.addr + 0x1C) + 1
        self.type = PVZ_memory.read_int(self.addr + 0x24)
        self.x = PVZ_memory.read_float(self.addr + 0x2C)
        self.y = PVZ_memory.read_float(self.addr + 0x30)
        self.size = PVZ_memory.read_float(self.addr + 0x11C)
        self.state = PVZ_memory.read_int(self.addr + 0x28)
        self.hp = PVZ_memory.read_int(self.addr + 0xC8)
        self.maxHP = PVZ_memory.read_int(self.addr + 0xCC)
        self.hatType = PVZ_memory.read_int(self.addr + 0xC4)
        self.hatHP = PVZ_memory.read_int(self.addr + 0xD0)
        self.maxHatHP = PVZ_memory.read_int(self.addr + 0xD4)
        self.doorType = PVZ_memory.read_int(self.addr + 0xD8)
        self.doorHP = PVZ_memory.read_int(self.addr + 0xDC)
        self.maxDoorHP = PVZ_memory.read_int(self.addr + 0xE0)
        self.slow = PVZ_memory.read_int(self.addr + 0xAC)
        self.butter = PVZ_memory.read_int(self.addr + 0xB0)
        self.frozen = PVZ_memory.read_int(self.addr + 0xB4)
        self.isVisible = PVZ_memory.read_bool(self.addr + 0x18)
        self.isEating = PVZ_memory.read_bool(self.addr + 0x51)
        self.isHpynotized = PVZ_memory.read_bool(self.addr + 0xB8)
        self.isBlow = PVZ_memory.read_bool(self.addr + 0xB9)
        self.isDying = PVZ_memory.read_bool(self.addr + 0xBA)
        self.isGarlic = PVZ_memory.read_bool(self.addr + 0xBF)
        self.stolenPlant = PVZ_memory.read_ushort(self.addr + 0x128)

    def setRow(self, row):
        PVZ_memory.write_int(self.addr + 0x1C, row - 1)

    def setX(self, x):
        PVZ_memory.write_float(self.addr + 0x2C, x)

    def setY(self, y):
        PVZ_memory.write_float(self.addr + 0x30, y)

    def setSize(self, size):
        PVZ_memory.write_float(self.addr + 0x11C, size)

    def setState(self, state):
        PVZ_memory.write_int(self.addr + 0x28, state)

    def setHP(self, hp):
        PVZ_memory.write_int(self.addr + 0xC8, hp)
        PVZ_memory.write_int(self.addr + 0xCC, hp)

    def setHatHP(self, hatHP):
        PVZ_memory.write_int(self.addr + 0xD0, hatHP)
        PVZ_memory.write_int(self.addr + 0xD4, hatHP)

    def setDoorHP(self, doorHP):
        PVZ_memory.write_int(self.addr + 0xDC, doorHP)
        PVZ_memory.write_int(self.addr + 0xE0, doorHP)

    def setSlow(self, slow):
        PVZ_memory.write_int(self.addr + 0xAC, slow)

    def setButter(self, butter):
        PVZ_memory.write_int(self.addr + 0xB0, butter)

    def setFrozen(self, frozen):
        PVZ_memory.write_int(self.addr + 0xB4, frozen)

    def setExist(self, exist):
        PVZ_memory.write_int(self.addr + 0xEC, exist)

    def setIsVisible(self, isVisible):
        PVZ_memory.write_bool(self.addr + 0x18, isVisible)

    def setIsEating(self, isEating):
        PVZ_memory.write_bool(self.addr + 0x51, isEating)

    def setIsHPynotized(self, isHPynotized):
        PVZ_memory.write_bool(self.addr + 0xB8, isHPynotized)

    def setIsBlow(self, isBlow):
        PVZ_memory.write_bool(self.addr + 0xB9, isBlow)

    def setIsDying(self, isDying):
        PVZ_memory.write_bool(self.addr + 0xBA, isDying)

    def setIsGarlic(self, isGarlic):
        PVZ_memory.write_bool(self.addr + 0xBF, isGarlic)

    def setStolenPlant(self, stolenPlant):
        PVZ_memory.write_ushort(self.addr + 0x128, stolenPlant)


class item:
    def __init__(self, addr):
        self.addr = addr
        self.no = PVZ_memory.read_ushort(self.addr + 0xE8)
        self.exist = PVZ_memory.read_bool(self.addr + 0x20)
        self.row = PVZ_memory.read_int(self.addr + 0x14) + 1
        self.col = PVZ_memory.read_int(self.addr + 0x10) + 1
        self.type = PVZ_memory.read_int(self.addr + 0x8)
        self.time = PVZ_memory.read_int(self.addr + 0x18)
        self.vase_skin = PVZ_memory.read_int(self.addr + 0xC)
        self.vase_zombie = PVZ_memory.read_int(self.addr + 0x3C)
        self.vase_plant = PVZ_memory.read_int(self.addr + 0x40)
        self.vase_type = PVZ_memory.read_int(self.addr + 0x44)
        self.vase_sun = PVZ_memory.read_int(self.addr + 0x50)
        self.vase_see_time = PVZ_memory.read_int(self.addr + 0x4C)

    def setExist(self, exist):
        PVZ_memory.write_bool(self.addr + 0x20, exist)

    def setRow(self, row):
        PVZ_memory.write_int(self.addr + 0x14, row - 1)

    def setCol(self, col):
        PVZ_memory.write_int(self.addr + 0x10, col - 1)

    def setTime(self, time):
        PVZ_memory.write_int(self.addr + 0x18, time)

    def setVaseSkin(self, vase_skin):
        PVZ_memory.write_int(self.addr + 0xC, vase_skin)

    def setVaseZombie(self, vase_zombie):
        PVZ_memory.write_int(self.addr + 0x3C, vase_zombie)

    def setVasePlant(self, vase_plant):
        PVZ_memory.write_int(self.addr + 0x40, vase_plant)

    def setVaseType(self, vase_type):
        PVZ_memory.write_int(self.addr + 0x44, vase_type)

    def setVaseSun(self, vase_sun):
        PVZ_memory.write_int(self.addr + 0x50, vase_sun)

    def setVaseSeeTime(self, vase_see_time):
        PVZ_memory.write_int(self.addr + 0x4C, vase_see_time)


class car:
    def __init__(self, addr):
        self.addr = addr
        self.exist = PVZ_memory.read_bool(self.addr + 0x30)
        self.no = PVZ_memory.read_ushort(self.addr + 0x44)
        self.row = PVZ_memory.read_int(self.addr + 0x14)

    def setExist(self, exist):
        PVZ_memory.write_bool(self.addr + 0x30, exist)


class slot:
    def __init__(self, addr):
        self.addr = addr
        self.no = PVZ_memory.read_ushort(self.addr + 0x2C)
        self.canUse = PVZ_memory.read_bool(self.addr + 0x48)
        self.type = PVZ_memory.read_int(self.addr + 0x34)
        self.imitaterType = PVZ_memory.read_int(self.addr + 0x34)
        self.cooldown = PVZ_memory.read_int(self.addr + 0x28)
        self.elapsed = PVZ_memory.read_int(self.addr + 0x24)
        self.isVisible = PVZ_memory.read_bool(self.addr + 0x18)
        self.count = PVZ_memory.read_int(self.addr + 0x4C)

    def setCanUse(self, canUse):
        PVZ_memory.write_bool(self.addr + 0x48, canUse)

    def setType(self, type):
        PVZ_memory.write_int(self.addr + 0x34, type)

    def setImitaterType(self, imitaterType):
        PVZ_memory.write_int(self.addr + 0x34, imitaterType)

    def setCooldown(self, cooldown):
        PVZ_memory.write_int(self.addr + 0x28, cooldown)

    def setElapsed(self, elapsed):
        PVZ_memory.write_int(self.addr + 0x24, elapsed)

    def setIsVisible(self, isVisible):
        PVZ_memory.write_bool(self.addr + 0x18, isVisible)

    def setCount(self, count):
        PVZ_memory.write_int(self.addr + 0x4C, count)


class plantCharacteristic:
    def __init__(self, type):
        self.type = type
        if PVZ_version < 3.4:
            if type < 256:
                self.addr = 0x007A2010 + type * 0x24
                self.sun = PVZ_memory.read_int(self.addr)
                self.cd = PVZ_memory.read_int(self.addr + 0x4)
                self.canAttack = PVZ_memory.read_bool(self.addr + 0x8)
                self.attackInterval = PVZ_memory.read_int(self.addr + 0xC)
            else:
                if PVZ_version == 2.0:
                    self.addr = 0x008452C8 + type - 256
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    self.addr = 0x0088B018 + type - 256
                    self.sun = PVZ_memory.read_uchar(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 2.3:
                    self.addr = 0x00088B04D + (type - 256) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 2.35 or PVZ_version == 2.36 or PVZ_version == 2.37:
                    self.addr = 0x0088B05D + (type - 256) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 2.4 or PVZ_version == 2.5 or PVZ_version == 2.51:
                    self.addr = 0x0088B072 + (type - 256) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 2.6 or PVZ_version == 2.61:
                    self.addr = 0x0088B072 + (type - 256) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 3.0:
                    self.addr = 0x0088B0F9 + (type - 256) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 3.1 or PVZ_version == 3.15:
                    self.addr = 0x0088B0F9 + (type - 256) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                elif PVZ_version == 3.2 or PVZ_version == 3.21 or PVZ_version == 3.3:
                    self.addr = 0x0088B119 + (type - 256) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
        else:
            if type < 512:
                self.addr = 0x007A2010 + type * 0x24
                self.sun = PVZ_memory.read_int(self.addr)
                self.cd = PVZ_memory.read_int(self.addr + 0x4)
                self.canAttack = PVZ_memory.read_bool(self.addr + 0x8)
                self.attackInterval = PVZ_memory.read_int(self.addr + 0xC)
            else:
                if PVZ_version == 3.4:
                    self.addr = 0x0088B119 + (type - 512) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                if PVZ_version == 3.5 or PVZ_version == 3.6:
                    self.addr = 0x0088B129 + (type - 512) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                if PVZ_version == 3.65:
                    self.addr = 0x0088B14A + (type - 512) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                if PVZ_version == 3.7 or PVZ_version == 3.75 or PVZ_version == 3.76:
                    self.addr = 0x0088B16B + (type - 512) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0
                if PVZ_version == 3.8:
                    self.addr = 0x0088B16B + (type - 512) * 0x4
                    self.sun = PVZ_memory.read_int(self.addr)
                    self.cd = 0
                    self.canAttack = True
                    self.attackInterval = 0

    def setSun(self, sun):
        PVZ_memory.write_int(self.addr, sun)

    def setCd(self, cd):
        PVZ_memory.write_int(self.addr + 0x4, cd)

    def setCanAttack(self, canAttack):
        PVZ_memory.write_bool(self.addr + 0x8, canAttack)

    def setAttackInterval(self, attackInterval):
        PVZ_memory.write_int(self.addr + 0xC, attackInterval)


class zombieType:
    def __init__(self, type):
        self.type = type
        if PVZ_version < 2.3:
            if type <= 54:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 51:
                if PVZ_version == 2.0:
                    self.weight = PVZ_memory.read_uchar(0x0085A887)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    self.weight = PVZ_memory.read_uchar(0x008D0887)
            elif type == 52:
                if PVZ_version == 2.0:
                    self.weight = PVZ_memory.read_uchar(0x0085A75F)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    self.weight = PVZ_memory.read_uchar(0x008D075F)
            elif type == 53:
                if PVZ_version == 2.0:
                    self.weight = PVZ_memory.read_uchar(0x0085A538)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    self.weight = PVZ_memory.read_uchar(0x008D0538)
            elif type == 54:
                if PVZ_version == 2.0:
                    self.weight = PVZ_memory.read_uchar(0x0085A613)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    self.weight = PVZ_memory.read_uchar(0x008D0613)
        elif PVZ_version == 2.3:
            if type <= 55:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 56:
                self.weight = PVZ_memory.read_uchar(0x008D0882)
            elif type == 57:
                self.weight = PVZ_memory.read_uchar(0x008D0743)
            elif type == 58:
                self.weight = PVZ_memory.read_uchar(0x008D051C)
            elif type == 59:
                self.weight = PVZ_memory.read_uchar(0x008D05F7)
        elif PVZ_version == 2.35 or PVZ_version == 2.36 or PVZ_version == 2.37:
            if type <= 58:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 59:
                self.weight = PVZ_memory.read_uchar(0x008D0896)
            elif type == 60:
                self.weight = PVZ_memory.read_uchar(0x008D0743)
            elif type == 61:
                self.weight = PVZ_memory.read_uchar(0x008D051C)
            elif type == 62:
                self.weight = PVZ_memory.read_uchar(0x008D05F7)
        elif PVZ_version == 2.4:
            if type <= 63:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 64:
                self.weight = PVZ_memory.read_uchar(0x008D0896)
            elif type == 65:
                self.weight = PVZ_memory.read_uchar(0x008D0743)
            elif type == 66:
                self.weight = PVZ_memory.read_uchar(0x008D051C)
            elif type == 67:
                self.weight = PVZ_memory.read_uchar(0x008D05F7)
        elif PVZ_version == 2.5 or PVZ_version == 2.51:
            if type <= 65:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 66:
                self.weight = PVZ_memory.read_uchar(0x008D0896)
            elif type == 67:
                self.weight = PVZ_memory.read_uchar(0x008D0743)
            elif type == 68:
                self.weight = PVZ_memory.read_uchar(0x008D051C)
            elif type == 69:
                self.weight = PVZ_memory.read_uchar(0x008D05F7)
        elif PVZ_version == 2.6:
            if type <= 74:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 75:
                self.weight = PVZ_memory.read_uchar(0x008D08C7)
            elif type == 76:
                self.weight = PVZ_memory.read_uchar(0x008D0774)
            elif type == 77:
                self.weight = PVZ_memory.read_uchar(0x008D0528)
            elif type == 78:
                self.weight = PVZ_memory.read_uchar(0x008D061B)
        elif PVZ_version == 2.61:
            if type <= 75:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 76:
                self.weight = PVZ_memory.read_uchar(0x008D08C7)
            elif type == 77:
                self.weight = PVZ_memory.read_uchar(0x008D0774)
            elif type == 78:
                self.weight = PVZ_memory.read_uchar(0x008D0528)
            elif type == 79:
                self.weight = PVZ_memory.read_uchar(0x008D061B)
        elif PVZ_version == 3.0:
            if type <= 83:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 84:
                self.weight = PVZ_memory.read_uchar(0x008D08C7)
            elif type == 85:
                self.weight = PVZ_memory.read_uchar(0x008D0774)
            elif type == 86:
                self.weight = PVZ_memory.read_uchar(0x008D0528)
            elif type == 87:
                self.weight = PVZ_memory.read_uchar(0x008D061B)
        elif (
            PVZ_version == 3.1
            or PVZ_version == 3.15
            or PVZ_version == 3.2
            or PVZ_version == 3.21
        ):
            if type <= 89:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 90:
                self.weight = PVZ_memory.read_uchar(0x008D0927)
            elif type == 91:
                self.weight = PVZ_memory.read_uchar(0x008D07C4)
            elif type == 92:
                self.weight = PVZ_memory.read_uchar(0x008D0529)
            elif type == 93:
                self.weight = PVZ_memory.read_uchar(0x008D066B)

        elif PVZ_version == 3.3 or PVZ_version == 3.4:
            if type <= 95:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 96:
                self.weight = PVZ_memory.read_uchar(0x008D0928)
            elif type == 97:
                self.weight = PVZ_memory.read_uchar(0x008D07C4)
            elif type == 98:
                self.weight = PVZ_memory.read_uchar(0x008D0529)
            elif type == 99:
                self.weight = PVZ_memory.read_uchar(0x008D066B)
        elif PVZ_version == 3.5:
            if type <= 101:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 102:
                self.weight = PVZ_memory.read_uchar(0x008D0928)
            elif type == 103:
                self.weight = PVZ_memory.read_uchar(0x008D07C4)
            elif type == 104:
                self.weight = PVZ_memory.read_uchar(0x008D0529)
            elif type == 105:
                self.weight = PVZ_memory.read_uchar(0x008D066B)
        elif PVZ_version == 3.6:
            if type <= 103:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 104:
                self.weight = PVZ_memory.read_uchar(0x008D0928)
            elif type == 105:
                self.weight = PVZ_memory.read_uchar(0x008D07C4)
            elif type == 106:
                self.weight = PVZ_memory.read_uchar(0x008D0529)
            elif type == 107:
                self.weight = PVZ_memory.read_uchar(0x008D066B)
        elif PVZ_version == 3.65:
            if type <= 106:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 107:
                self.weight = PVZ_memory.read_uchar(0x008D0928)
            elif type == 108:
                self.weight = PVZ_memory.read_uchar(0x008D07C4)
            elif type == 109:
                self.weight = PVZ_memory.read_uchar(0x008D0529)
            elif type == 110:
                self.weight = PVZ_memory.read_uchar(0x008D066B)
        elif PVZ_version == 3.7 or PVZ_version == 3.75 or PVZ_version == 3.76:
            if type <= 109:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 110:
                self.weight = PVZ_memory.read_uchar(0x008D0928)
            elif type == 111:
                self.weight = PVZ_memory.read_uchar(0x008D07C4)
            elif type == 112:
                self.weight = PVZ_memory.read_uchar(0x008D0529)
            elif type == 113:
                self.weight = PVZ_memory.read_uchar(0x008D066B)
        elif PVZ_version == 3.8:
            if type <= 111:
                self.addr = 0x007A6000 + type * 0x1C
                self.anime = PVZ_memory.read_int(self.addr + 0x4)
                self.level = PVZ_memory.read_int(self.addr + 0x8)
                self.weight = PVZ_memory.read_int(self.addr + 0x14)
            elif type == 112:
                self.weight = PVZ_memory.read_uchar(0x008D0928)
            elif type == 113:
                self.weight = PVZ_memory.read_uchar(0x008D07C4)
            elif type == 114:
                self.weight = PVZ_memory.read_uchar(0x008D0529)
            elif type == 115:
                self.weight = PVZ_memory.read_uchar(0x008D066B)

    def setAnime(self, anime):
        PVZ_memory.write_int(self.addr + 0x4, anime)

    def setLevel(self, level):
        PVZ_memory.write_int(self.addr + 0x4, level)

    def setWeight(self, weight):
        if PVZ_version < 2.3:
            if self.type <= 50:
                PVZ_memory.write_int(self.addr + 0x14, weight)
            elif self.type == 51:
                if PVZ_version == 2.0:
                    PVZ_memory.write_uchar(0x0085A887, weight)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    PVZ_memory.write_uchar(0x008D089E, weight)
            elif self.type == 52:
                if PVZ_version == 2.0:
                    PVZ_memory.write_uchar(0x0085A75F, weight)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    PVZ_memory.write_uchar(0x008D075F, weight)
            elif self.type == 53:
                if PVZ_version == 2.0:
                    PVZ_memory.write_uchar(0x0085A538, weight)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    PVZ_memory.write_uchar(0x008D0538, weight)
            elif self.type == 54:
                if PVZ_version == 2.0:
                    PVZ_memory.write_uchar(0x0085A613, weight)
                elif PVZ_version == 2.1 or PVZ_version == 2.2:
                    PVZ_memory.write_uchar(0x008D0613, weight)
        elif PVZ_version == 2.3:
            if self.type <= 55:
                PVZ_memory.write_int(self.addr + 0x14, weight)
            elif self.type == 56:
                PVZ_memory.write_uchar(0x008D0882, weight)
            elif self.type == 57:
                PVZ_memory.write_uchar(0x008D0743, weight)
            elif self.type == 58:
                PVZ_memory.write_uchar(0x008D051C, weight)
            elif self.type == 59:
                PVZ_memory.write_uchar(0x008D05F7, weight)
        elif PVZ_version == 2.35 or PVZ_version == 2.36 or PVZ_version == 2.37:
            if self.type <= 58:
                PVZ_memory.write_int(self.addr + 0x14, weight)
            elif self.type == 59:
                PVZ_memory.write_uchar(0x008D0896, weight)
            elif self.type == 60:
                PVZ_memory.write_uchar(0x008D0743, weight)
            elif self.type == 61:
                PVZ_memory.write_uchar(0x008D051C, weight)
            elif self.type == 62:
                PVZ_memory.write_uchar(0x008D05F7, weight)
        elif PVZ_version == 2.4:
            if self.type <= 63:
                PVZ_memory.write_int(self.addr + 0x14, weight)
            elif self.type == 64:
                PVZ_memory.write_uchar(0x008D0896, weight)
            elif self.type == 65:
                PVZ_memory.write_uchar(0x008D0743, weight)
            elif self.type == 66:
                PVZ_memory.write_uchar(0x008D051C, weight)
            elif self.type == 67:
                PVZ_memory.write_uchar(0x008D05F7, weight)
        elif PVZ_version == 2.4:
            if self.type <= 65:
                PVZ_memory.write_int(self.addr + 0x14, weight)
            elif self.type == 66:
                PVZ_memory.write_uchar(0x008D0896, weight)
            elif self.type == 67:
                PVZ_memory.write_uchar(0x008D0743, weight)
            elif self.type == 68:
                PVZ_memory.write_uchar(0x008D051C, weight)
            elif self.type == 69:
                PVZ_memory.write_uchar(0x008D05F7, weight)


potted_size = 0x58


class potted:
    def __init__(self, addr):
        self.addr = addr
        self.no = (int)(
            (
                addr
                - 0x30000
                - PVZ_memory.read_int(PVZ_memory.read_int(0x6A9EC0) + 0x82C)
            )
            / 0x58
        )
        self.type = PVZ_memory.read_int(self.addr)
        self.garden = PVZ_memory.read_int(self.addr + 0x4)
        self.col = PVZ_memory.read_int(self.addr + 0x8)
        self.row = PVZ_memory.read_int(self.addr + 0xC)
        self.direction = PVZ_memory.read_int(self.addr + 0x10)
        self.color = PVZ_memory.read_int(self.addr + 0x20)
        self.state = PVZ_memory.read_int(self.addr + 0x24)
        self.water = PVZ_memory.read_int(self.addr + 0x28)
        self.waterMax = PVZ_memory.read_int(self.addr + 0x2C)

    def setType(self, type):
        PVZ_memory.write_int(self.addr, type)

    def setGarden(self, garden):
        PVZ_memory.write_int(self.addr + 0x4, garden)

    def setCol(self, col):
        PVZ_memory.write_int(self.addr + 0x8, col)

    def setRow(self, row):
        PVZ_memory.write_int(self.addr + 0xC, row)

    def setDirection(self, direction):
        PVZ_memory.write_int(self.addr + 0x10, direction)

    def setColor(self, color):
        PVZ_memory.write_int(self.addr + 0x20, color)

    def setState(self, state):
        PVZ_memory.write_int(self.addr + 0x24, state)

    def setWater(self, water):
        PVZ_memory.write_int(self.addr + 0x28, water)

    def setWaterMax(self, waterMax):
        PVZ_memory.write_int(self.addr + 0x2C, waterMax)
